﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Stocks.aspx.cs" Inherits="GPSTrackingWebsiteManager.Manager.Pages.Stocks" %>

<!DOCTYPE html>

<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.11.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
        <script type="text/javascript">
            function resizeGrid() {
                var tableView = $find("<%=StocksGrid.ClientID %>");
                tableView.get_element().style.height = (window.innerHeight) + "px";

                document.getElementById('HiddenFieldHeight').value = (window.innerHeight);


            }

            //Windows Message Manager 
            var objWindowsMessageManager = new WindowsMessageManager();

        </script>
    </telerik:RadScriptBlock>
</head>
<body onresize="resizeGrid()" style="overflow: hidden">
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="StocksGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="StocksGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="298" />
        <asp:HiddenField ID="HiddenFieldError" runat="server" />
        <telerik:RadGrid ID="StocksGrid" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" GroupingSettings-CaseSensitive="false" OnDeleteCommand="StocksGrid_DeleteCommand" OnInsertCommand="StocksGrid_InsertCommand" OnNeedDataSource="StocksGrid_NeedDataSource" OnUpdateCommand="StocksGrid_UpdateCommand">
            <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                <CommandItemTemplate>
                    <div style="padding: 5px 5px;">
                        Menu:                              
                             <asp:LinkButton ID="lbClearFilters" runat="server" OnClick="lbClearFilters_Click" Visible='<%# !StocksGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>
                        <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error técnivo</asp:LinkButton>
                    </div>
                </CommandItemTemplate>
                <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Nuevo Master" RefreshText="Actualizar"></CommandItemSettings>

                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

                <Columns>
                    <telerik:GridBoundColumn DataField="CompanyId" HeaderText="Compañía" UniqueName="CompanyId" ForceExtractValue="Always" Display="false" ReadOnly="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="StockId" HeaderText="ID Producto" UniqueName="StockId" ForceExtractValue="Always" ReadOnly="true" FilterControlWidth="50px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="70px" AutoPostBackOnFilter="true">
                        <HeaderStyle Width="70px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="StockCode" HeaderText="Código" UniqueName="StockCode"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true" FilterControlAltText="Filter StockCode column">
                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                            <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                        </ColumnValidationSettings>

                        <HeaderStyle Width="130px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="StockBarCode" FilterControlAltText="Filter StockBarCode column" HeaderText="Código Barras" UniqueName="StockBarCode"
                        FilterControlWidth="100px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Nombre" UniqueName="Name"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Descripción" UniqueName="Description"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PromotionalNote" FilterControlAltText="Filter PromotionalNote column" HeaderText="Nota Promocional" UniqueName="PromotionalNote"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Brand" FilterControlAltText="Filter Brand column" HeaderText="Marca" UniqueName="Brand"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UnitStock" HeaderText="Unidad de Venta" UniqueName="UnitStock" MaxLength="50"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">                        
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UnitStockByBox" HeaderText="Unidad de Venta por Caja" UniqueName="UnitStockByBox" MaxLength="50"
                        FilterControlWidth="120px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px" AutoPostBackOnFilter="true">                       
                    </telerik:GridBoundColumn>
                    <telerik:GridNumericColumn DataField="Quantity" DecimalDigits="0"  HeaderText="Cantidad" UniqueName="Quantity" 
                        AllowFiltering="true" FilterControlWidth="60px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="90px" AutoPostBackOnFilter="true">                        
                    </telerik:GridNumericColumn>
                    <telerik:GridNumericColumn DataField="MinQuantity" DecimalDigits="0" FilterControlAltText="Filter Quantity column" HeaderText="Cantidad Mínima" UniqueName="MinQuantity" 
                        AllowFiltering="true" FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">                        
                    </telerik:GridNumericColumn>
                    <telerik:GridNumericColumn DataField="Price" DecimalDigits="0" HeaderText="Precio" UniqueName="Price" DataFormatString="{0:C0}"
                        FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                    </telerik:GridNumericColumn>
                </Columns>

                <EditFormSettings>
                    <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>

                    <PopUpSettings Modal="True"></PopUpSettings>
                </EditFormSettings>
            </MasterTableView>
            <GroupingSettings CaseSensitive="False"></GroupingSettings>

            <ClientSettings EnableRowHoverStyle="true">
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                <Selecting AllowRowSelect="True"></Selecting>
                <ClientEvents OnPopUpShowing="PopUpShowing" />
            </ClientSettings>
            <FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
    </form>
</body>
</html>
